package model

import (
	"github.com/starmotioncf/common/db/field"
	"github.com/starmotioncf/common/setting"
)

type Setting struct {
	Id              int64                   `json:"id" gorm:"primaryKey;autoIncrement;comment:主键编码"`
	Key             string                  `json:"key" gorm:"column:key;type:varchar(100);notNull;comment:key"`             //配置key
	Val             field.JSONType[any]     `json:"val" gorm:"column:val;type:text;comment:val"`                             //配置值
	ConditionValues setting.ConditionValues `json:"condition_values" gorm:"column:condition_values;type:text;comment:条件配置值"` //条件配置值
	CreateBy        int64                   `json:"create_by" gorm:"column:create_by;notNull;comment:创建人"`
	UpdateBy        int64                   `json:"update_by" gorm:"column:update_by;notNull;comment:更新人"`
	CreatedAt       int64                   `json:"created_at" gorm:"column:created_at;autoCreateTime;type:bigint;notNull"`
	UpdatedAt       int64                   `json:"updated_at" gorm:"column:updated_at;autoUpdateTime;type:bigint;notNull"`
}

func (Setting) TableName() string {
	return "setting" // 修正表名以匹配SQL定义
}
